<template>
  <section>
    <!-- <textarea class="comm_comm_area" v-model="commComm"></textarea> -->
    <el-input class="input" :placeholder="'评论'+id.ID.tag" rows='2' resize='none' maxlength=100
            type="textarea"
            v-model="commComm"></el-input>
    <div class="sure_comm"
      @click="sureComm">提交</div>
  </section>
</template>
<script>
export default {
  props:['id'],
  data(){
    return{
      commComm:'',//评论内容
    }
  },
  methods:{
    // 确认提交评论
    sureComm(){
      //评论为空直接return
      if (this.commComm.trim()==='')return;
      this.GLOBAL.tokenRequest({
        method:'post',
        baseURL:this.GLOBAL.API_RNTY_URL,
        url:'ftcomments/publish',
        data:{
          content:this.commComm,
          pid:this.id.ID.pid,//评论帖子|回复的id
          tid:Number(this.id.ID.tid),//板块id
          top_comment_id:this.id.ID.top_comment
        }
      }).then(({data:data})=>{
        // this.$router.go(0)
        this.$emit('upup',this.id.ID.pid);
        this.commComm = '';
      })
    }
  }
}
</script>
<style scoped>
section{
  position: relative;
}
.comm_comm_area{
  width:790px;
  height: 60px;
  margin:15px 0 0 10px;
  outline: none;
  resize: none;
  padding: 3px 10px;
  border: 1px solid #dedede;
}
.sure_comm{
  position: absolute;
  right:0px;
  bottom:-30px;
  cursor: pointer;
  width:60px;
  height:30px;
  background-color: #3c7cff;
  color:#fff;
  text-align: center;
  border-radius: 5px;
  line-height: 30px;
}
</style>

